//
//  MainBtnView.m
//  AnnCar_user
//
//  Created by LiBenCan on 17/10/23.
//  Copyright © 2017年 LiBenCan. All rights reserved.
//

#import "MainBtnView.h"

@implementation MainBtnView

- (instancetype)initWithFrame:(CGRect)frame BtnImageArr:(NSArray *)btnImageArr
{
    if (self = [super initWithFrame:frame]) {
        
        self.backgroundColor = backColor;
        
       
        for (int i = 0 ; i < 5; i++) {//循环创建按钮
            float x;
            float y;
            float height;
            if (i<2) { //我要洗车 我的订单按钮
                x = 0;
                y = 150*screenW_6*i;
                height = 145*screenW_6;
            }else// 我的钱包 充值中心 我的电子券
            {
                x = SCREENW/2+3*screenW_6;
                y = 100*screenW_6*(i-2);
                height = 95*screenW_6;
            }
            UIImageView  *imageV = [TomamaUI createImageView:CGRectMake(x,y,SCREENW/2-3*screenW_6,height) backGroundImageV:btnImageArr[i]];
            imageV.tag = i;//区分点击事件
            imageV.userInteractionEnabled = YES;
            [self addSubview:imageV];
            UITapGestureRecognizer *tapBtnBig = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(btnBigVTap:)];
            [imageV addGestureRecognizer:tapBtnBig];
        }
    }
    return self;
}
//图片点击事件
-(void)btnBigVTap:(UITapGestureRecognizer *)tap
{
    if (_btnSelectBlock) {
        self.btnSelectBlock(tap.view.tag);
    }
}


@end
